|
|
|
|
|
|
|
To display the File Open dialog box, perform the ShowOpen method on the common dialog control. Of course, youll most likely want to set some additional properties prior to showing the dialog box. |
|
|
|
|
|
|
|
|
Using the Filter Property |
|
|
|
|
|
|
|
|
To use the Filter property, set the filter to a multipart string delimited with the pipe character (|). The first part of each filter will start with the words you want to have appear in the Files of Type combo box at the bottom of the File Open dialog box. The second part after the pipe delimiter is the wildcard characters you use to select the files of that particular type. For example, in the preceding code, you would set the filter property as follows: |
|
|
|
 |
|
|
|
|
cdlCommon.Filter = "Access Databases (*.mdb)|*.mdb|" & _
"INI Files (*.ini)|*.ini|" & _
"All Files (*.*)|*.*" |
|
|
|
|
|
|
|
|
You can select three different types of files with the dialog box that are opened with this filter set (MDB, INI, and all files). Note that you cannot have any spaces between the pipe character and the other characters. |
|
|
|
 |
|
|
|
|
TIP Make sure you dont put spaces between the pipe characters in the Filter property. |
|
|
|
|
|
|
|
|
You can use the Flags property to change the way the File Open dialog box works. Table 11.5 lists some of the more common flags. |
|
|
|
|
| Table 11.5 Flags You Might Set for the File Open Dialog Box. | | Flag Constant | Description | | cdlOFNAllowMultiSelect | Allows the user to select multiple filenames using the Shift or Ctrl key. | | cdlOFNExplorer | Opens an Explorer-like dialog box instead of the old-style Windows dialog box. | | cdlOFNFileMustExist | When this flag is set, the file the user is trying to select must already exist. |
|
|
|
|
|
|
(table continued on next page) |
|
|
|
|
|